<?php $this->load->view('header.tpl');?>


<div id="content" class="clearfix">
	<div class="main">
		<div class="mod">
			<h1><a href="/admin">go to admin home</a></h1>
			<div class="error"><?php echo validation_errors(); ?></div>
			<div class="error"><?php echo $error; ?></div>
			<div class="success"><?php echo $success; ?></div>
			<form action="<?=$action?>" method="post" name="lzform" id="lzform">
			  <input type="hidden" value="simple" name="source">
				<div class="item">
					<label>name</label>
					<input type="text" tabindex="1" value="<?=set_value('name')?>" class="basic-input" name="name" id="name">
				</div>
				<div class="item">
					<label>website</label>
					<input type="text" tabindex="2" value="<?=set_value('website')?>"class="basic-input" name="website" id="website">
				</div>
				<div class="item">
					<label>avatar</label>
					<input type="hidden" name="avatar" id="avatar" value="<?=set_value('avatar')?>"/>
					<img style="cursor:pointer;" src="<? echo set_value('avatar') ? '/'.set_value('avatar') : '/imgs/avatar.jpg';?>" id="upload" width="100"/>
					<div id="status"></div>
				</div>
				<div class="item">
					<label>office</label>
					<input type="text" tabindex="4"class="basic-input" value="<?=set_value('office')?>" name="office" id="office">
				</div>
				<div class="item">
					<label>address</label>
					<input type="text" tabindex="5" value="<?=set_value('address')?>"  class="basic-input" name="address" id="address">
				</div>
				<div class="item">
					<label>email</label>
					<input type="text" tabindex="6" value="<?=set_value('email')?>" class="basic-input" name="email" id="email">
				</div>
				<div class="item">
					<label>brif</label>
					<textarea tabindex="7" class="basic-input" name="brif" id="brif" style="height:100px;width:300px;"><?=set_value('brif')?></textarea>
				</div>
				<div class="item">
					<label>introduction</label>
					<textarea tabindex="8" class="basic-input" name="introduction" id="introduction" style="height:150px;width:450px;"><?=set_value('introduction')?></textarea>
				</div>
				<div class="item">
					<label>country</label>
					<input type="text" tabindex="9" class="basic-input" value="<?=set_value('country')?>"name="country" id="country">
				</div>
				<div class="item">
					<label>phone</label>
					<input type="text" tabindex="10" class="basic-input" name="phone"value="<?=set_value('phone')?>" id="phone">
				</div>
				<div class="item">
					<label>fax</label>
					<input type="text" tabindex="11" class="basic-input" value="<?=set_value('fax')?>"name="fax" id="fax">
				</div>
				<div class="item">
					<label>tag</label>
					<input type="text" tabindex="11" class="basic-input" value="<?=set_value('tag')?>"name="tag" id="tag" style="width:300px;">
					<p class="tip">please separated by ",",if more than one tag! eg:tag1,tag2,tag3</p>
				</div>
				<div class="item">
					<label>&nbsp;</label>
					<input type="submit" tabindex="12" class="button" name="user_login" value="<?=$button?>">
				</div>
			</form>
		</div>
		
	</div><!-- end main -->

		<?$this->load->view('aside.tpl')?>

</div><!-- end content -->
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/AjaxUpload.js"></script>
<script type="text/javascript" >
$(function(){
image_upload();
});
function image_upload(){

		var btnUpload=$('#upload');
		new AjaxUpload(btnUpload, {
			action: '/admin/picsave',
			//Name of the file input box
			name: 'uploadfile',
			onSubmit: function(file, ext){
				if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
					  // check for valid file extension
					status.html('<p style="color:#00A1E9;">目前只支持 JPG,PNG,GIF等格式,如果是以上格式，请尝试后缀使用小写！');
					return false;
				}
			},
			onComplete: function(file, response){
				//On completion clear the status
				//Add uploaded file to list
				var json = eval('(' + response + ')');
				btnUpload.attr('src',json.path);
				$("#avatar").val(json.value);
			}
		});
}
</script>
<?php $this->load->view('footer.tpl');?>